#pragma once

#include <iterator>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

template <class TContainer, class TElement>
class IContainerType 
{
public:
	friend class boost::serialization::access;
	typedef typename TContainer::iterator iterator;
	typedef typename TContainer::const_iterator citerator;
	typedef typename TContainer::reverse_iterator riterator;
	
	template<class Archive> 
	void serialize(Archive & ar, const unsigned int version) 
	{
		ar & layers;
	}

	iterator begin()
	{
		return layers.begin();
	}

	iterator end()
	{
		return layers.end();
	}

	citerator cbegin() const
	{
		return layers.begin();
	}

	citerator cend() const
	{
		return layers.end();
	}

	riterator rbegin()
	{
		return layers.rbegin();
	}

	riterator rend()
	{
		return layers.rend();
	}

	const TContainer& getContainerReadOnly() const 
	{
		return layers;
	}

	TContainer& getContainerToModify()
	{
		return layers;
	}

	virtual void add(const TElement& element) = 0;

protected:
	TContainer layers;
};

BOOST_SERIALIZATION_ASSUME_ABSTRACT(IContainerType)